﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using HBPVPDruid.Misc;

namespace HBPVPDruid.Spells
{
    /// <summary>
    /// Should only be used when its a instant cast.
    /// </summary>
    public static class Starsurge
    {
        public const string SpellName = "Starsurge";
        public static readonly int SpellDistance = 40;
        private static LocalPlayer Me { get { return ObjectManager.Me; } }


        public static bool Pulse(WoWUnit Player)
        {
            // Quick Checks to return false
            if (Player.Distance > 40) return false;
            if (!HasShootingStar) return false;
            if (!SpellManager.CanCast(SpellName)) return false;

            Misc.Misc.CastLog(SpellName, Player.Name);
            SpellManager.Cast(SpellName, Player);
            return true;
        }


        /// <summary>
        /// Cannot use the normal finding methods due to the fact "Shooting Stars" is a passive buff.
        /// </summary>
        public static bool HasShootingStar
        {
            get
            {
                foreach (var Pair in Me.Auras)
                {
                    if (Pair.Value.SpellId == 93400)
                    {
                        return true;
                    }
                }
                return false;
            }
        }
    }
}
